///Cbase.h Holds all basic functionality
///Author: Robert Martinez
/// Date:9/29/2011

#pragma once
#include "IBaseInterface.h"
#include "SGD Wrappers\SGD_Math.h"

enum ObjTypes
{
	OBJ_BASE,
	OBJ_TANK=0,
	OBJ_TURRET,
	OBJ_BULLET
};

class CBase: public IBaseInterface
{
protected:
	int m_nType;

	int m_nTexID;	//the handle to our texture
	float m_fPosX;	//our position in space
	float m_fPosY;

	//	velocity
	tVector2D m_tVelocity;
	float m_fVelX;	// how fast we move
	float m_fVelY;

	int m_nDamage;

	int m_nWidth;
	int m_nHeight;
	unsigned int m_unRefCount;

	bool m_bIsActive;
public:

	/// Accessors/Modifiers
	int GetTexID(void) { return m_nTexID; }
	float GetPosX(void) { return m_fPosX; }
	float GetPosY(void) { return m_fPosY; }
	float GetVelX(void) { return m_fVelX; }
	float GetVelY(void) { return m_fVelY; }
	int GetType(void) { return m_nType; }
	bool GetActive(void) {return m_bIsActive;}

	void SetTexID(int _nTexID) { m_nTexID = _nTexID; }
	void SetPosX(float _fPosX) { m_fPosX = _fPosX; }
	void SetPosY(float _fPosY) { m_fPosY = _fPosY; }
	void SetVelX(float _fVelX) { m_fVelX = _fVelX; }
	void SetVelY(float _fVelY) { m_fVelY = _fVelY; }
	void SetActive(bool _bIsActive) {m_bIsActive = _bIsActive;}

	CBase(void);
	virtual ~CBase(void);

	virtual RECT GetCollisonRect();

	virtual bool CheckCollison(IBaseInterface *_pIBase);

	//	virtual update
	virtual void Update(float _fElapsedTime);

	void Render(void);

	void AddRef(void) {

		m_unRefCount++;

	}
	void Release(void) {

		m_unRefCount--;
		if(m_unRefCount == 0)
		{
			delete this;
		}
	}
};

